package com.ruoyi.web.dao.sys;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.web.domain.sys.UserPassKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ResPassKeyMapper extends BaseMapper<UserPassKey> {
    // 根据passkey查询
    @Select("SELECT * FROM user_passkey WHERE passkey = #{passkey}")
    UserPassKey getByPasskey(String passkey);

    // updateById方法已经由BaseMapper提供，不需要额外定义

    // 可选：创建唯一索引
    @Select("CREATE UNIQUE INDEX IF NOT EXISTS idx_passkey ON user_passkey(passkey)")
    void createPasskeyIndex();
}
